package com.tianshuo.circledepend.main;

import com.tianshuo.circledepend.config.CircleConfig;
import com.tianshuo.circledepend.model.Class;
import com.tianshuo.circledepend.model.Student;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @ClassName : AnnotationApplicationContextTest
 * @Description : AnnotationApplicationContext类 测试循环依赖
 * @Author : tianshuo
 * @Date: 2020-08-28 14:34
 */
public class AnnotationApplicationContextTest {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext =
                                            new AnnotationConfigApplicationContext();
        applicationContext.register(CircleConfig.class);
        //通过此API加进去的BeanDefinitionRegistryPostProcessor,会在的解析的成bd之前执行，
        //并且会先于内部的spring内置的BeanDefinitionRegistryPostProcessor
//        applicationContext.addBeanFactoryPostProcessor(new CustomBeanDefinitionRegistryPostProcessor());
        applicationContext.refresh();
        System.out.println(applicationContext.getBean(Class.class));
        System.out.println(applicationContext.getBean(Student.class));

    }
}

